import { createRouter, createWebHashHistory } from 'vue-router';

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/Home.vue'),
      meta: {
        name: '首页',
      },
    },
    {
      path: '/classify',
      name: 'classify',
      component: () => import('@/views/classify/Classify.vue'),
      meta: {
        name: '分类',
      },
    },
    {
      path: '/cart',
      name: 'cart',
      component: () => import('@/views/cart/Cart.vue'),
      meta: {
        name: '购物车',
        hideTabBar: true,
      },
    },
    {
      path: '/mine',
      name: 'mine',
      component: () => import('@/views/mine/Mine.vue'),
      meta: {
        name: '个人信息',
      },
    },
    {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('@/views/detail/Detail.vue'),
      meta: {
        //是否隐藏tabbar
        hideTabBar: true,
      },
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('@/views/search/Search.vue'),
      meta: {
        //是否隐藏tabbar
        hideTabBar: true,
      },
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/Login.vue'),
      meta: {
        //是否隐藏tabbar
        hideTabBar: true,
      },
    },
  ],
});

export default router;
